package com.example.purchase.view.activity;

import androidx.recyclerview.widget.LinearLayoutManager;

import android.view.View;

import com.example.purchase.MyApplication;
import com.example.purchase.R;
import com.example.purchase.adapter.RecyclerViewAdapter;
import com.example.purchase.bean.BaseBean;
import com.example.purchase.databinding.ActivityFavoriteBinding;
import com.example.purchase.view.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

public class FavoriteActivity extends BaseActivity<ActivityFavoriteBinding> {

    private List beanList = new ArrayList<>();

    @Override
    protected boolean isSetActionBar() {
        return true;
    }

    @Override
    protected boolean isStatusBarEnabled() {
        return false;
    }

    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_favorite;
    }

    @Override
    protected void initData() {
        for (int i = 0; i < 20; i++) {
            BaseBean listBean = new BaseBean();
            beanList.add(listBean);
        }
    }

    @Override
    protected void initEmpty() {
        if (beanList.isEmpty()){
            dataBinding.recyclerView.setVisibility(View.GONE);
            dataBinding.empty.setVisibility(View.VISIBLE);
        }else {
            dataBinding.recyclerView.setVisibility(View.VISIBLE);
            dataBinding.empty.setVisibility(View.GONE);
            dataBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
        }
        switch (getIntent().getIntExtra("type",0)){
            case MyApplication.ORDER_LIST:
                dataBinding.toolbarTitle.setText("订单列表");
                dataBinding.recyclerView.setAdapter(new RecyclerViewAdapter<>(beanList,this,MyApplication.ORDER_LIST,1));
                break;
            case MyApplication.LOVE_LIST:
                dataBinding.toolbarTitle.setText("喜欢列表");
                dataBinding.recyclerView.setAdapter(new RecyclerViewAdapter<>(beanList,this, MyApplication.LOVE_LIST,1));
                break;
            case MyApplication.ADMIN_ORDER:
                dataBinding.toolbarTitle.setText("订单管理");
                dataBinding.recyclerView.setAdapter(new RecyclerViewAdapter<>(beanList,this, MyApplication.ADMIN_ORDER,1));
                break;
        }
    }

    @Override
    protected void initClick() {

    }

    @Override
    protected void initTimeOut() {

    }
}